<script setup>
import { getQueryString } from "@/utils/common";
const appid = "wxdf48c27f2d58324d";

const getWechatCode = () => {
  const url = window.location.href;
  const urlArr = url.split("?");
  const goodsId = getQueryString("goodsId", urlArr[1]);
  const inviteCode = getQueryString("inviteCode", urlArr[1]);
  const local = encodeURIComponent(
    `https://pdd.bkd.fit/#/giftCallback?goodsId=${goodsId}&inviteCode=${inviteCode}`
  );
  window.location.href =
    "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
    appid +
    "&redirect_uri=" +
    local +
    "&response_type=code&scope=snsapi_base&connect_redirect=1#wechat_redirect";
};

getWechatCode();
</script>
